/*
 * types .h
 *  
 *	Defines shared data structures for nodes and gateway:
 *
 */

/** Hello Gateway / Hi PACKET **/
typedef struct{
	uint8_t src_addr;
	uint8_t dest_addr;
	uint8_t seq_no;
} HGHi_pkt;

/** Hello Gateway Response PACKET **/
typedef struct{
	uint8_t src_addr;
	uint8_t dest_addr;
	uint8_t next_hop;
	uint8_t seq_no;
} HGResponse_pkt;

/** Network Configaration PACKET **/
typedef struct{
	uint8_t src_addr;
	uint8_t dest_addr;
	uint8_t configuration_info; //[7:5] give 3 sensors info and [4:0] gives rate of reporting
	uint8_t seq_no;
} NetworkConfig_pkt;

/** Data (sensor data) PACKET **/
typedef struct{
	uint8_t src_addr;
	uint8_t dest_addr;
	uint16_t sensor_data[3]; 
	uint8_t seq_no;
} data_pkt;

/** Routing Data PACKET **/
typedef struct{
	uint8_t src_addr;
	uint8_t dest_addr;
	uint8_t is_neighbour; //First [7:4] gives isNeighbour info and [3:0] gives isPathtoGateway info
	uint8_t rssi_value[4]; 
	uint8_t seq_no;
} routingData_pkt;

/* packet types */
typedef struct{
	uint8_t src_addr;
	uint8_t dest_addr;
	uint8_t length;
	uint8_t seq_no;
	uint8_t age;
} pktCache_entry;	

#define PKT_CACHE_SIZE 8

#define BROADCAST		0xff
#define GATEWAY                 0x00

